package api

import (
	"b2c-delivery-optimization/internal/services"

	"github.com/gin-gonic/gin"
)

// SetupRoutes 设置API路由
func SetupRoutes(r *gin.Engine, waveService *services.WaveService) {
	// 创建处理器
	waveHandler := NewWaveHandler(waveService)

	// API版本分组
	v1 := r.Group("/api/v1")
	{
		// 波次管理路由
		waves := v1.Group("/waves")
		{
			waves.POST("", waveHandler.CreateWave)
			waves.GET("", waveHandler.ListWaves)
			waves.GET("/:id", waveHandler.GetWave)
			waves.PUT("/:id/status", waveHandler.UpdateWaveStatus)
			waves.POST("/:id/orders", waveHandler.AddOrdersToWave)
			waves.GET("/:id/orders", waveHandler.GetWaveOrders)
			waves.GET("/:id/predict", waveHandler.PredictReleaseTime)
			waves.POST("/allocate", waveHandler.AllocateOrdersToWaves)
		}
	}
}
